<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>
	    员工列表
	</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link href="__PUBLIC__/skin/nei.css" type="text/css" rel="stylesheet"> 
</head>
<body onLoad="initPage(),list()">
<div id="LoadingBar"><img src="__PUBLIC__/images/load.gif" /></div>
<div class="contaiter">	
	<div class="shuaxin" onclick="location.reload()" title="刷新">&#xe614;</div>
	<div class="nei01">	
    	<div class="nei01_02">
        	<form class="layui-form" action="?" method="get">  
               <div class="layui-form-item">
                <div class="layui-input-inline">  
                 </div>  
             </div>    
           </form>
        </div>   
    </div>
    <div class="nei02">
        <div class="nei02_01 l01">
            <div class="nei02_01_07">
            	<h3>
                	<i><label><input type="checkbox"><tt>✓</tt></label></i>
                	<span class="s01">登录人</span>
                    <span class="s01">登录IP</span>
                    <span class="s01">登录系统</span>
                    <span class="s01">登录时间</span>
                    <span class="s03"></span>
                </h3>
                <div class="nei02_01_07_01" id="list1">
                </div>
                <div class="nei02_01_04_02" id="pageDemo"></div>
            </div>
        </div>
    </div>    
</div>   

<input type="hidden" id="pages1" name="pages1" value="1">

<script src="__PUBLIC__/js/jquery-1.10.2.min.js" type="application/javascript"></script>

<script src="__PUBLIC__/js/neijqtab.js" type="application/javascript"></script>

<script src="__PUBLIC__/js/xlayui/layui.js" charset="utf-8"></script>

<script>

function initPage(){   

	var objLoading = document.getElementById("LoadingBar");   

	if (objLoading != null){   

		objLoading.style.display = "none";   

		$(".contaiter").css("display","block");

	}   

}  

</script>

<script>

layui.use(['form','laypage', 'layer'], function(){ //独立版的layer无需执行这一句

  var $ = layui.jquery,form = layui.form(),laypage = layui.laypage, layer = layui.layer; //独立版的layer无需执行这一句    

  form.on('select(field)', function(data){	 

  		field();	

  });  

});



function openChuang(title,url){

	field = $("#field").val()

	 var othis = $(this), method = othis.data('method');

    //多窗口模式，层叠置顶

      layer.open({

        type: 2 //此处以iframe举例

        ,title: title

        ,area: ['100%', '100%']

        ,shade: 0

        ,maxmin: true

        ,offset: [ //为了演示，随机坐标

          $(window).height()-$(window).height()

          ,$(window).width()-$(window).width()

        ] 

        ,content: url

      });  

}



function pageNum(id,total,pages){

	layui.use('laypage', function(){ //独立版的layer无需执行这一句

	var laypage = layui.laypage; //独立版的layer无需执行这一句  

	laypage({

		cont: id //分页容器的id

		,pages: total //总页数

		,skin: '#5FB878' //自定义选中色值

		,curr: pages //当前页

		,skip: true //开启跳页

		,jump: function(obj, first){

		if(!first){			

			layer.msg('第'+ obj.curr +'页',{time:300});

			if(id=="pageDemo") list(obj.curr);

		}

		}

		});	

	});		

}



function list(pages){		

	$.ajax({

		type: "POST",

		async:false,

		contentType:"application/x-www-form-urlencoded; charset=UTF-8",

		url: "__ROOT__/admin/log/lists/",

		data: {pagesize:9,pages:pages},

		error:function(msg){ 

			alert("错误");

		},

		success:function(msg){

			 json = msg.data;
			 var html="";

			 for(var i=0; i<json.length; i++)   

			 {  


			   var shenfen="";

			   if(json[i].ma_l==1) shenfen="超级管理员";

			   if(json[i].ma_l==2) shenfen="普通管理员";

			   html += '<li><i><label><input type="checkbox" value="'+json[i].id+'"><tt>✓</tt></label></i><span class="s01">'+json[i].ma_name+'</span><span class="s01">'+json[i].ma_ip+'</span><span class="s01">'+json[i].ma_system+'</span><span class="s01">'+json[i].ma_addtime+'</span><span class="s03 layui-btn layui-btn-nonebg-1" onclick=openDelete('+json[i].id+')>&#xe6f4;</span></li>';

			 }  

			 $('#list1').html(html);

			 pageNum('pageDemo',msg.totalpage,pages);		

			  if(pages>1)

			 	$("#pages1").val(msg.totalpage);

			 else

				$("#pages1").val(1);	

		}

	});		

}

function openDelete(id){

	layer.confirm('确定要删除本条信息吗，删除无法恢复?', {icon: 3, title:'删除提示框'}, function(index){

		var loading2 = layer.load();			

		$.ajax({

			url:"__ROOT__/admin/log/delete/",

			type:"POST",

			data:{id:id},

			dataType:"",

			success:function(json){

				layer.close(loading2);

				if(json==1){			

					layer.alert("删除成功!");		

					list($("#pages1").val());

				}else{

					layer.alert("删除失败",{time:1000});						

				}

				layer.close(index);

			},

			error:function(res){

				alert('ajax错误!');

			}

		});		return false;

		

	});

}



</script>

</body>

</html>

